<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------

namespace Home\Controller;
use OT\DataDictionary;

/**
 * 前台三屏主站控制器
 * 主要获取三屏主站聚合数据
 */
class MainsiteController extends HomeController {

	//三屏主站
    public function index(){
    	$uid = $_SESSION['home']['user_auth']['uid'];
        $Company = D('Company')->where('uid='.$uid)->select();
        $cid = $Company[0]['id'];
    	$list = D('domain')->where('cid='.$cid)->select();
    	// echo '<pre>';
    	// print_r($list);
    	// exit;
    	$this->assign('list',$list);
        $this->display();
    }

    public function map(){

        $this->display();
    }


    public function mapadd(){
    	$data = $_POST;
        $uid = $_SESSION['home']['user_auth']['uid'];
        $Company = D('Company')->where('uid='.$uid)->select();
        $cid = $Company[0]['id'];
    	$data['cid'] = $cid;
    	
		$map = D('map');
    	$result = $map->add($data);

	    if($result){
	   		$this->display('Mainsite/map');
    	}else{
    		$this->error('新增失败!');
    	}
    	
       
    }

    public function links(){

        $this->display();
    }

    public function linksadd(){
    	$data = $_POST;
        $uid = $_SESSION['home']['user_auth']['uid'];
        $Company = D('Company')->where('uid='.$uid)->select();
        $cid = $Company[0]['id'];
    	$data['cid'] = $cid;
    	// print_r($data);
    	// exit;
    	
		$links = D('links')->add($data);
		// echo '<pre>';
		// print_r($links);
  		// exit;
    	$result = $links;
    	// var_dump($result);
    	// exit;
	    if($result){
	   		$this->display('Mainsite/index');
    	}else{
    		$this->error('新增失败!');
    	}

    }

}